﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace SimplexEngine
{
    public class MRTBasicMaterial : Material
    {
        public MRTBasicMaterial()
        {
            effect = Root.Instance.ContentSystem.GetResource("MRT.Shader");
            technique_name = "Basic";
        }

        protected override void OnApplyParameters(GameTime game_time, Int64 frame_number)
        {         
            Effect.Parameters["DiffuseTexture"].SetValue(DiffuseTexture.Texture);
            ApplyBasicParameters(game_time, frame_number);
        }

        public override void SetParameters(Dictionary<String, Object> parameters)
        {
            base.SetParameters(parameters);

            if (parameters.ContainsKey("DiffuseTexture"))
                diffuse_texture = parameters["DiffuseTexture"] as MaterialTexture;            
        }

        public override Dictionary<String, Object> GetParameters()
        {
            Dictionary<String, Object> parameters = base.GetParameters();
            parameters.Add("DiffuseTexture", DiffuseTexture);

            return parameters; ;
        }

        public MaterialTexture DiffuseTexture { get { return diffuse_texture; } }
        protected MaterialTexture diffuse_texture = new MaterialTexture();

        public override Material Clone()
        {
            MRTBasicMaterial material = new MRTBasicMaterial();
            material.diffuse_texture = diffuse_texture;
            return material;
        }
    }
}
